USE [nop190Dev]
GO

/****** Object:  View [dbo].[Nop_Report_Order]    Script Date: 09/15/2012 14:43:05 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[Nop_Report_Order]
AS
SELECT     o.OrderID, o.OrderGUID, o.CustomerID, o.CustomerLanguageID, o.CustomerTaxDisplayTypeID, o.CustomerIP, o.OrderSubtotalInclTax, o.OrderSubtotalExclTax, 
                      o.OrderSubTotalDiscountInclTax, o.OrderSubTotalDiscountExclTax, o.OrderShippingInclTax, o.OrderShippingExclTax, o.PaymentMethodAdditionalFeeInclTax, 
                      o.PaymentMethodAdditionalFeeExclTax, o.TaxRates, o.OrderTax, o.OrderTotal, o.RefundedAmount, o.OrderDiscount, o.OrderSubtotalInclTaxInCustomerCurrency, 
                      o.OrderSubtotalExclTaxInCustomerCurrency, o.OrderSubTotalDiscountInclTaxInCustomerCurrency, o.OrderSubTotalDiscountExclTaxInCustomerCurrency, 
                      o.OrderShippingInclTaxInCustomerCurrency, o.OrderShippingExclTaxInCustomerCurrency, o.PaymentMethodAdditionalFeeInclTaxInCustomerCurrency, 
                      o.PaymentMethodAdditionalFeeExclTaxInCustomerCurrency, o.TaxRatesInCustomerCurrency, o.OrderTaxInCustomerCurrency, o.OrderTotalInCustomerCurrency, 
                      o.OrderDiscountInCustomerCurrency, o.CustomerCurrencyCode, o.CheckoutAttributeDescription, o.CheckoutAttributesXML, o.OrderWeight, o.AffiliateID, 
                      o.OrderStatusID, o.AllowStoringCreditCardNumber, o.CardType, o.CardName, o.CardNumber, o.MaskedCreditCardNumber, o.CardCVV2, o.CardExpirationMonth, 
                      o.CardExpirationYear, o.PaymentMethodID, o.PaymentMethodName, o.AuthorizationTransactionID, o.AuthorizationTransactionCode, o.AuthorizationTransactionResult, 
                      o.CaptureTransactionID, o.CaptureTransactionResult, o.SubscriptionTransactionID, o.PurchaseOrderNumber, o.PaymentStatusID, o.PaidDate, o.BillingFirstName, 
                      o.BillingLastName, o.BillingPhoneNumber, o.BillingEmail, o.BillingFaxNumber, o.BillingCompany, o.BillingAddress1, o.BillingAddress2, o.BillingCity, 
                      o.BillingStateProvince, o.BillingStateProvinceID, o.BillingZipPostalCode, o.BillingCountry, o.BillingCountryID, o.ShippingStatusID, o.ShippingFirstName, 
                      o.ShippingLastName, o.ShippingPhoneNumber, o.ShippingEmail, o.ShippingFaxNumber, o.ShippingCompany, o.ShippingAddress1, o.ShippingAddress2, 
                      o.ShippingCity, o.ShippingStateProvince, o.ShippingStateProvinceID, o.ShippingZipPostalCode, o.ShippingCountry, o.ShippingCountryID, o.ShippingMethod, 
                      o.ShippingRateComputationMethodID, o.ShippedDate, o.TrackingNumber, o.DeliveryDate, o.VatNumber, o.Deleted, o.CreatedOn, opv.OrderProductVariantID, 
                      opv.ProductVariantID, opv.UnitPriceInclTax, opv.UnitPriceExclTax, opv.PriceInclTax, opv.PriceExclTax, opv.UnitPriceInclTaxInCustomerCurrency, 
                      opv.UnitPriceExclTaxInCustomerCurrency, opv.PriceInclTaxInCustomerCurrency, opv.PriceExclTaxInCustomerCurrency, opv.AttributeDescription, opv.AttributesXML, 
                      opv.Quantity, opv.DiscountAmountInclTax, opv.DiscountAmountExclTax, opv.DownloadCount, opv.OrderProductVariantGUID, opv.IsDownloadActivated, 
                      opv.LicenseDownloadID, pv.ProductID, pv.Name, pv.SKU, pv.Description, pv.AdminComment, pv.ManufacturerPartNumber, pv.IsGiftCard, pv.GiftCardType, 
                      pv.IsDownload, pv.DownloadID, pv.UnlimitedDownloads, pv.MaxNumberOfDownloads, pv.DownloadExpirationDays, pv.DownloadActivationType, 
                      pv.HasSampleDownload, pv.SampleDownloadID, pv.HasUserAgreement, pv.UserAgreementText, pv.IsRecurring, pv.CycleLength, pv.CyclePeriod, pv.TotalCycles, 
                      pv.IsShipEnabled, pv.IsFreeShipping, pv.AdditionalShippingCharge, pv.IsTaxExempt, pv.TaxCategoryID, pv.ManageInventory, pv.StockQuantity, 
                      pv.DisplayStockAvailability, pv.DisplayStockQuantity, pv.MinStockQuantity, pv.LowStockActivityID, pv.NotifyAdminForQuantityBelow, pv.Backorders, 
                      pv.OrderMinimumQuantity, pv.OrderMaximumQuantity, pv.WarehouseID, pv.DisableBuyButton, pv.CallForPrice, pv.Price, pv.OldPrice, pv.ProductCost, 
                      pv.CustomerEntersPrice, pv.MinimumCustomerEnteredPrice, pv.MaximumCustomerEnteredPrice, pv.Weight, pv.Length, pv.Width, pv.Height, pv.PictureID, 
                      pv.AvailableStartDateTime, pv.AvailableEndDateTime, pv.Published, pv.DisplayOrder, pv.UpdatedOn, p.Name AS ProductName, p.ShortDescription, p.FullDescription, 
                      p.TemplateID, p.ShowOnHomePage, p.MetaKeywords, p.MetaDescription, p.MetaTitle, p.SEName, p.AllowCustomerReviews, p.AllowCustomerRatings, p.RatingSum, 
                      p.TotalRatingVotes
FROM         dbo.Nop_Order AS o INNER JOIN
                      dbo.Nop_OrderProductVariant AS opv ON o.OrderID = opv.OrderID INNER JOIN
                      dbo.Nop_ProductVariant AS pv ON opv.ProductVariantID = pv.ProductVariantId INNER JOIN
                      dbo.Nop_Product AS p ON pv.ProductID = p.ProductId

GO

EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[15] 4[47] 2[21] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1[19] 4[56] 3) )"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 1
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "o"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 125
               Right = 407
            End
            DisplayFlags = 280
            TopColumn = 2
         End
         Begin Table = "opv"
            Begin Extent = 
               Top = 17
               Left = 524
               Bottom = 136
               Right = 792
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "pv"
            Begin Extent = 
               Top = 121
               Left = 33
               Bottom = 240
               Right = 273
            End
            DisplayFlags = 280
            TopColumn = 2
         End
         Begin Table = "p"
            Begin Extent = 
               Top = 210
               Left = 496
               Bottom = 329
               Right = 696
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
      PaneHidden = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 2820
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'Nop_Report_Order'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'Nop_Report_Order'
GO

